package org.ruoyi.common.dhuman.ppt;

import java.io.File;

public class PPTProcessorDemo {
	public static void main(String[] args) {
		File file = new File("C:\\Users\\Admin\\Videos","暖城鄂尔多斯：自然与人文的艺术之旅.pptx");
		PPTProcessor processor = new PPTProcessor();

		// 处理PPT文件
		String ocrLanguagePath = "D:\\workspace\\tesseract-main\\tessdata";
		PPTContent content = processor.processPPT(file.getAbsolutePath(), ocrLanguagePath);

		// 输出结果
		System.out.println("PPT总页数: " + content.getTotalSlides());
		System.out.println("=====================================");

		for (SlideContent slide : content.getSlides()) {
			System.out.println("第 " + slide.getSlideNumber() + " 页:");

			// 输出文字内容
			if (slide.getTextContent() != null && !slide.getTextContent().isEmpty()) {
				System.out.println("文字内容:");
				System.out.println(slide.getTextContent());
			}

			// 输出图片OCR结果
			if (!slide.getImages().isEmpty()) {
				System.out.println("图片识别结果:");
				for (int i = 0; i < slide.getImages().size(); i++) {
					ImageContent image = slide.getImages().get(i);
					System.out.println("图片 " + (i + 1) + " OCR结果:");
					System.out.println(image.getOcrText());
				}
			}

			System.out.println("-------------------------------------");
		}
	}
}